import requestYbsDevice from '@/utils/request/index2.js'

const api = {
	home: 'home',
	joinHome: 'message/agree/home',
	exitHome: 'share/remove',
	setHomeNickName: 'home2/nic',
}

// 更新家庭信息
export function updateHome(data) {
	return requestYbsDevice.put(api.home + "/" + data.id, data, {
		header: {
			'content-type': 'application/x-www-form-urlencoded',
		}
	})
}

// 获取家庭信息
export function getHomeInfo(id) {
	return requestYbsDevice.get(api.home + "/" + id, {});
}

// 加入家庭 homeId invitedUserId
export function joinHome(data) {
	return requestYbsDevice.get(api.joinHome, data)
}

// 退出家庭 homeId userId
export function exitHome(data) {
	return requestYbsDevice.put(api.exitHome, data)
}

// 修改家庭成员备注 nic userId toUserId
export function setHomeNickName(data) {
	return requestYbsDevice.post(api.setHomeNickName, data)
}